package com.rainng.coursesystem.controller;

import com.rainng.coursesystem.dao.RegisterDao;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.service.RegisterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.rainng.coursesystem.model.vo.response.ResultVO.FAIL;
import static com.rainng.coursesystem.model.vo.response.ResultVO.SUCCESS;

@RestController
@RequestMapping("/sign")
@Slf4j
public class RegisterController {
    @Autowired
    RegisterService registerService;
    @PostMapping("/signIn")
    public ResultVO register(@RequestBody RegisterDao ro){
        String obj = registerService.register(ro);
        if(obj.equals("注册成功")){
            return new ResultVO(SUCCESS,"注册成功",ro);
        }else{
            return new ResultVO(FAIL,"注册失败",ro);
        }
    }

}
